package com.example.carefree_server.service.impl.i_managerImpl;

import com.example.carefree_server.entity.Student;
import com.example.carefree_server.mapper.m_managerMapper.StudentMapper;
import com.example.carefree_server.service.s_managerService.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public List<Student> getAllStudents() {
        return studentMapper.getAllStudents();
    }

    @Override
    public Student addStudent(Student student) {
        studentMapper.insertStudent(student);
        return student;
    }

    @Override
    public Student findStudentById(String sid) {
        return studentMapper.findStudentById(sid);
    }

    @Override
    public Student updateStudent(Student student) {
        studentMapper.updateStudent(student);
        return student;
    }

    @Override
    public void deleteStudentById(String sid) {
        studentMapper.deleteStudentById(sid);
    }

}
